package com.genia.toolbox.web.io;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.multipart.MultipartHttpServletRequest;

/**
 * Factory method for the proxy of {@link HttpServletRequest}.
 */
public class HttpServletRequestProxyFactory
{

  /**
   * the factory method.
   * 
   * @param request
   *          the {@link HttpServletRequest} to proxy
   * @return a proxy for the {@link HttpServletRequest}
   */
  public static HttpServletRequestProxy getHttpServletRequestProxy(HttpServletRequest request)
  {
    if (request instanceof MultipartHttpServletRequest) {
      return new MultipartHttpServletRequestProxy((MultipartHttpServletRequest) request);
    }
    return new HttpServletRequestProxy(request);
  }
}
